package com.guoyansoft.config;

public class R {
    private Integer code; //状态码
    private String msg;   //成功/失败
    private Long total;   //总记录数
    private Object data;  //数据
    public static R fail(){
        return getInstance(500,"失败",0L,null);
    }
    public static R suc(){
        return getInstance(200,"成功",0L,null);
    }
    public static R suc(Long total,Object data){
        return getInstance(200,"成功",total,data);
    }
    public static R suc(Object data){
        return getInstance(200,"成功",0L,data);
    }
    public static R getInstance(
            Integer code,
             String msg,
             Long total,
             Object data
    ){
        R r=new R();
        r.code=code;
        r.msg=msg;
        r.total=total;
        r.data=data;
        return r;
    }

    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    public Long getTotal() {
        return total;
    }

    public Object getData() {
        return data;
    }
}
